function Events() {
    this.callbacks = []
    this.results = []
}
Events.prototype.on = function (callback) {//订阅
    this.callbacks.push(callback)
}
Events.prototype.emit = function (data) {//发布
    this.results.push(data)
    this.callbacks.forEach(c => (this.results))
}
e.on(function (arr) {
    console.log(arr);
})

e.on(function (arr) {
    console.log(arr);
})
e.emit(data)

let e = new Events()